/*
 * CXmlParser.h
 *
 *  Created on: 2010-4-5
 *      Author: Administrator
 */

#ifndef CXMLPARSER_H_
#define CXMLPARSER_H_

#include "IXmlParser.h"
#include <contenthandler.h> 
#include <parser.h>
#include "RPointerStack.h"

using namespace Xml;

class CXmlParser : public CBase,
				   public IXmlParser, 
				   public MContentHandler
	{
public:
	CXmlParser();
	virtual ~CXmlParser();
	
public:
	virtual IUIControl* ParseXmlL(const TDesC& aDes);
	
public:
	void OnStartDocumentL( const RDocumentParameters &aDocParam,TInt aErrorCode );
	void OnEndDocumentL( TInt aErrorCode );
	void OnStartElementL( const RTagInfo &aElement,const RAttributeArray &aAttributes, TInt aErrorCode );
	void OnEndElementL( const RTagInfo &aElement, TInt aErrorCode );
	void OnContentL( const TDesC8 &aBytes, TInt aErrorCode );
	void OnStartPrefixMappingL( const RString &aPrefix, const RString &aUri,TInt aErrorCode );
	void OnEndPrefixMappingL( const RString &aPrefix, TInt aErrorCode );
	void OnIgnorableWhiteSpaceL( const TDesC8 &aBytes, TInt aErrorCode );
	void OnSkippedEntityL( const RString &aName, TInt aErrorCode );
	void OnProcessingInstructionL( const TDesC8 &aTarget, const TDesC8 &aData,TInt aErrorCode);
	void OnError( TInt aErrorCode );
	TAny *GetExtendedInterface( const TInt32 aUid );
	
private:
	CParser*	iParser;
	IUIControl* iFirstNode;
	RPointerStack<IUIControl> iUICtrlStack;
public:
	static CXmlParser* NewL();
	static CXmlParser* NewLC();
	
private:
	void ConstructL();
	};

#endif /* CXMLPARSER_H_ */
